#include <stdio.h>

int fn( int a, int n );
int SumA( int a, int n );
	
int main()
{
    int a, n;

    scanf("%d %d", &a, &n);
    printf("fn(%d, %d) = %d\n", a, n, fn(a,n));		
    printf("s = %d\n", SumA(a,n));	
	
    return 0;
}

/* 你的代码将被嵌在这里 */
int fn( int a, int n )
{
	int i,ret=0,buff=1;
	for(i=0;i<n;i++)
	{
		ret+=a*buff;
		buff*=10;
	}
	return ret;
}

int SumA( int a, int n )
{
	int sum=0,i;
	for(i=1;i<=n;i++)
		sum=sum+fn(a,i);
	return sum;
}